<template>
	<view class="boby">
		<Search class="search"></Search>
		<view class="header">
			<view class="header-left">
				<image src="https://z3.ax1x.com/2021/04/09/cNUvOU.png"></image>
				<text>填写爱车信息可以匹配到更合适的宝贝哦</text>
			</view>
			
			<view class="header-rgiht">
				<text>添加</text>
				<image src="https://z3.ax1x.com/2021/04/09/cNaemD.png"></image>
			</view>
		</view>
		
		<view class="center" v-for="item in commodity" :key="item.productId">
			<navigator :url="'../productDetails/productDetails?productId='+item.productId" open-type="navigate" hover-class="none" hover-stop-propagation="true" class="goodlist">
				<!-- 左边 -->
				<view class="center-left">
					<image :src="item.productImage"></image>
				</view>
				<!-- 右边 -->
				<view class="center-right">
					<view>{{item.productName}}</view>
					<view>1080P | 3.0英寸 | 120°-149°</view>
					<view>包邮到家</view>
					<view>
						<text>￥{{item.productPrice}}</text>
						<navigator url="../mall-shoppingCart/mall-shoppingCart"  hover-stop-propagation="true" open-type="navigate">
							<image @click="addOrder(item.productId)" src="https://z3.ax1x.com/2021/04/08/cYEn6U.png"></image>
						</navigator>
					</view>
				</view>
			</navigator>
		</view>
		<view class="center" v-for="item in commodity" :key="item.productId">
			<navigator :url="'../productDetails/productDetails?productId='+item.productId" open-type="navigate" hover-class="none" hover-stop-propagation="true" class="goodlist">
				<!-- 左边 -->
				<view class="center-left">
					<image :src="item.productImage"></image>
				</view>
				<!-- 右边 -->
				<view class="center-right">
					<view>{{item.productName}}</view>
					<view>1080P | 3.0英寸 | 120°-149°</view>
					<view>包邮到家</view>
					<view>
						<text>￥{{item.productPrice}}</text>
						<navigator url="../mall-shoppingCart/mall-shoppingCart"  hover-stop-propagation="true" open-type="navigate">
							<image src="https://z3.ax1x.com/2021/04/08/cYEn6U.png"></image>
						</navigator>
						<!-- <view @click="jump">
							<image src="https://z3.ax1x.com/2021/04/08/cYEn6U.png"></image>
						</view> -->
						
					</view>
				</view>
			</navigator>
		</view>
	</view>
</template>

<script>

	import Search from '../../../components/mall-search/mall-search.vue'
	
	import  {createNamespacedHelpers}  from "vuex"
	const{mapState,mapActions,mapMutations}=createNamespacedHelpers("mall")
	export default {
		data() {
			return {
			}
		},
		methods: {
			...mapActions(['getCommoditylist']),
			...mapMutations(["setCommodity"]),
			//立即购买
			addOrder(id) {
				
			},
		},
		onLoad(option) {
			// console.log(987,option.cateId);
			const val=option.cateId
			this.getCommoditylist(val)
		},
		components:{
			Search
		},
		computed:{
			...mapState(["commodity"])
		}
		
	}
</script>

<style lang="scss" scoped>
	.boby{
		box-sizing: border-box;
		width: 100vw;
		.search{
			border: 0rpx;
			margin: 0rpx;
		}
		.header{
			width: 100vw;
			height: 80rpx;
			display: flex;
			line-height: 80rpx;
			justify-content: space-between;
			background-color: #fff7e2;
			.header-left{
				margin-left: 20rpx;
				width: 80%;
				height: 100%;
				display: flex;
				align-items: center;
				image{
					margin-right: 20rpx;
					width: 60rpx;
					height: 60rpx;
				}
				text{
					
					font-size: 26rpx;
					color: #ff7417;
					
				}
			}
			.header-rgiht{
				width: 20%;
				height: 100%;
				display: flex;
				align-items: center;
				text{
					color: #ff7417;
					font-size: 26rpx;
					font-weight: 550;
					margin-left: 20rpx;
					margin-right: 20rpx;
				}
				image{
					width: 30rpx;
					height: 30rpx;
				}
			}
		}
		.center{
			width: 100%;
			// height: 300rpx;
			.goodlist{
				display: flex;
				margin: 24rpx;
				border-bottom:1rpx solid #ebe6e6 ;
				.center-left{
					width: 100%;
					margin-top: 50rpx;
					text-align: center;
					align-items: center;
					width: 40%;
					image{
						width: 200rpx;
						height: 200rpx;
					}
				}
				.center-right{
					width: 60%;
					view{
						margin: 20rpx;
						&:nth-of-type(1){
							color: #333333;
							font-weight: 550;
						}
						&:nth-of-type(2){
							color: #808080;
							font-size: 28rpx;
							
						}
						&:nth-of-type(3){
							width: 120rpx;
							height: 40rpx;
							text-align: center;
							line-height: 40rpx;
							border-radius: 20rpx;
							border: 2rpx solid #0bb2ff;
							background-color: #effffe;
							color:  #0bb2ff;
							font-size: 24rpx;
						}
						&:nth-of-type(4){
							display: flex;
							justify-content: space-between;
							text{
								color: #ff7417;
								font-weight: 550;
							}
							image{
								width: 40rpx;
								height: 40rpx;
							}
						}
					}
					
				}
			}
			
		}
	}

</style>
